﻿cmake_minimum_required(VERSION 3.20)
project(Tools)

set(OPENCV_PATH ${CMAKE_CURRENT_LIST_DIR}/../lib/opencv/)

# Qt配置
set(CMAKE_AUTOUIC ON) # UI转C++
set(CMAKE_AUTORCC ON) # 资源
set(CMAKE_AUTOMOC ON) # 信号槽

# C++版本
#set(CMAKE_CXX_STANDARD 20)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 COMPONENTS Quick Widgets QuickControls2 Pdf Sql REQUIRED)

string(APPEND OPENCV_PATH "msvc/lib")
find_package(OpenCV REQUIRED PATHS ${OPENCV_PATH})

add_executable(${PROJECT_NAME} WIN32
    main.cpp
    qml.qrc
    logo.rc
    pdfutil.h pdfutil.cpp
    pdfimageprovider.h pdfimageprovider.cpp
    datamodel.h datamodel.cpp
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    Qt6::Quick
    Qt6::Widgets
    Qt6::QuickControls2
    Qt6::Pdf
    Qt6::Sql
    ${OpenCV_LIBS}
)

# 设置bin输出路径
set(RUNTIME "${CMAKE_CURRENT_LIST_DIR}/../bin/${TOOL}")
set_target_properties(${PROJECT_NAME} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY ${RUNTIME}
    RUNTIME_OUTPUT_DIRECTORY_DEBUG ${RUNTIME}
    RUNTIME_OUTPUT_DIRECTORY_RELEASE ${RUNTIME}
)

# 1. 新建main.cpp qml.rc main.qml logo.rc logo.ico ，QtCreate打开进行基础代码添加即可IDE编译运行
